﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Passwords.Biz;
using System.Threading;
using Silvermoon.Controls.Forms;

namespace Passwords.Pages
{
    public static class Helper
    {
        public static void DeleteCategory(this Category category, ThreadStart onOK)
        {
            if (category == null) throw new ArgumentNullException("category");
            try
            {
                MessageDialog.Show("Delete Category?", "This will also remove all relations to " + category.Name + ".", "Delete", "Cancel",
                    () =>
                    {
                        category.Delete();
                        if (onOK != null) onOK();
                    }, null);
            }
            catch (Exception)
            {
                MessageDialog.Show("Database error", "Could not delete category " + category.Name);
            }

        }
    }
}
